package com.yupi.yupipicturebackend.exception;

public class ThrowUtils {

    /**
     *
     * @param condtion
     * @param runtimeException
     */
    public static void throwIf(boolean condtion,RuntimeException runtimeException) {
        if(condtion){
            throw runtimeException;
        }
    }

    /**
     *
     * @param condtion
     * @param errorCode
     */
    public static void throwIf(boolean condtion,ErrorCode errorCode){
        throwIf(condtion,new BusinessException(errorCode));
    }

    /**
     *
     * @param condtion
     * @param errorCode
     * @param message
     */
    public static void throwIf(boolean condtion,ErrorCode errorCode,String message){
        throwIf(condtion,new BusinessException(errorCode,message));

    }
}
